// RealPlay Ltd  copyrights.
// This program is Open Source AsIs
// You may use it for all purposes, including commercial
// But!!!
// If you use any part of this code, you must state clearly
// both in your source file and in the Help|about of your program,
// that the origin program or code was built by RealPlay Ltd

// ***********************************************************************/
// *                                                                     */
// *       This unit is the Mount to carrier dialog for  "Paint" Program */
// *                                                                     */
// ***********************************************************************/

unit UPCarrierMount;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;

type
  TFCarrierMount = class(TForm)
    CBoxCarrier: TComboBox;
    Label1: TLabel;
    GBPhone: TGroupBox;
    Label2: TLabel;
    CBPhone: TCheckBox;
    PhoneNu: TEdit;
    PhoneExt: TEdit;
    GBPass: TGroupBox;
    Epass: TEdit;
    CBPass: TCheckBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure CBPhoneClick(Sender: TObject);
    procedure PhoneNuExit(Sender: TObject);
    procedure CBPassClick(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FCarrierMount: TFCarrierMount;

implementation

uses UPUtil;
{$R *.dfm}

procedure TFCarrierMount.CBPhoneClick(Sender: TObject);
begin
  If CBPhone.Checked then
  begin
    GBPhone.Enabled := false;
    PhoneNu.Color := clBtnFace;
    PhoneExt.Color := clBtnFace;
  end
  else
  begin
    GBPhone.Enabled := true;
    PhoneNu.Color := clWhite;
    PhoneExt.Color := clWhite;
  end;
end;

procedure TFCarrierMount.PhoneNuExit(Sender: TObject);
var
  ti: integer;
begin
  ti := strtoint(PhoneNu.Text);
  if ti < 2010001 then
    ti := 2010001;
  if ti > 9999998 then
    ti := 9999998;
  PhoneNu.Text := inttostr(ti);
end;

procedure TFCarrierMount.CBPassClick(Sender: TObject);
begin
  If CBPass.Checked then
  begin
    GBPass.Enabled := false;
    Epass.Color := clBtnFace;
  end
  else
  begin
    GBPass.Enabled := true;
    Epass.Color := clWhite;
  end;
end;

procedure TFCarrierMount.BitBtn1Click(Sender: TObject);
begin
  Close;
end;

procedure TFCarrierMount.FormCreate(Sender: TObject);
var
  st: string;
begin
{$IF not define(DEBUG)}
  Epass.PasswordChar := '*';
{$IFEND}
  st := UPUtil.PingTrigRead;
  if st <> '' then
    Epass.Text := st;
end;

procedure TFCarrierMount.FormDestroy(Sender: TObject);
begin
  UPUtil.PingTrigWrite(Epass.Text);
end;

end.
